package com.att.config;

import com.android.ddmlib.IShellOutputReceiver;

public class OutputReceiver implements IShellOutputReceiver {

    private ReceiverCallback callback;
    
    public void setCallback(ReceiverCallback callback) {
        this.callback = callback;
    }
    
    @Override
    public void addOutput(byte[] arg0, int arg1, int arg2) {
        String result = new String(arg0, arg1, arg2);
        if (callback != null) {
            callback.doPerform(result);
        } else {
             System.out.println(result);
        }
    }

    @Override
    public void flush() {
    }

    @Override
    public boolean isCancelled() {
        return false;
    }
    
}
